<div class="form-group">
  <label for="sort">
    Sort On
  </label>

  <select
    class="form-control"
    name="sortField"
    required
    ng-model="agg.params.sortField"
    ng-show="sortFieldOptions.length"
    auto-select-if-only-one="sortFieldOptions"
    ng-options="field as field.displayName group by field.type for field in sortFieldOptions">
  </select>
</div>

<div class="form-group">
  <label>
    Order
  </label>

  <select
     name="sortOrder"
     ng-model="agg.params.sortOrder"
     required
     ng-options="opt as opt.display for opt in aggParam.options track by opt.val"
     class="form-control">
  </select>
</div>
